<?php
session_start();
error_reporting(E_ALL ^ E_NOTICE);
define("INC",dirname(__FILE__)."/");
require_once(INC."cache/settings.php");
require_once(INC."config.php");
define("DB_PRE",$cfg['database']['pref']);
if(file_exists(INC."db_".$cfg['database']['type'].".php")){
	require_once(INC."db_".$cfg['database']['type'].".php");
	$db_class = "db_".$cfg['database']['type'];
	$db = new $db_class;
}else{
	//throw an error. (soon)
}
require_once(INC."class_core.php");
$phprpg = new core;
$phprpg->settings = $settings;
$getTheme = $db->select("themes","*","id = ".$phprpg->settings['defaultTheme']);
$theme = $db->fetchrow($getTheme);
if(!defined(IN_ACP)){
	require_once(INC."class_templates.php");
	$templates = new templates;
	if(defined("NO_LOGIN")){
		eval("\$toplinks = \"".$templates->get("header_guestlinks")."\";");
		$userpanel = "";
	}else{
		if($phprpg->player['pgroup']['isAdmin'] == 1){
			eval("\$acplink = \"".$templates->Get("header_acplink")."\";");
		}
		eval("\$toplinks = \"".$templates->get("header_userlinks")."\";");
		eval("\$userpanel = \"".$templates->get("header_userpanel")."\";");
	}
	eval("\$header = \"".$templates->get("header")."\";");
	$stylesheets = "";
	$getStylesheets = $db->select("stylesheets","*","theme=".$phprpg->settings['defaultTheme']);
	while($s = $db->fetchrow($getStylesheets)){
		$stylesheets .= "<link rel=\"stylesheet\" href=\"{$phprpg->settings['gameurl']}css.php?theme={$s['theme']}&name={$s['name']}\" />";
	}
	eval("\$headerincludes = \"".$templates->get("headerincludes")."\";");
	eval("\$footer = \"".$templates->get("footer")."\";");
}
?>